<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta content="width=device-width, initial-scale=1.0" name="viewport">
  <title>Document</title>
  <script src="https://unpkg.com/react@18/umd/react.development.js"></script>
  <script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>

  <!-- Don't use this in production: -->
  <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
</head>

<body>
<div id="root"></div>
<div id="app"></div>
<script type="text/babel">

  class APP extends React.Component {
    // 组件数据
    constructor() {
      super()
      this.state = {
        message: 'hello,react'
      }
    }

    //渲染内容 render方法
    render() {
      const {message} = this.state
      return (
        <div>
          <h2>
            {message}
          </h2>
        </div>
      )
    }
  }

  const root = ReactDOM.createRoot(document.getElementById('root'))
  root.render(<APP/>)
</script>
</body>

</html>